﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace CMS_GYM
{
    public class clsTheBUS
    {
        /// <summary>
        /// Đối tượng Thẻ DAO
        /// </summary>
        private clsTheDAO TheDAO = new clsTheDAO();

        /// <summary>
        /// Lấy bảng thẻ theo khách hàng
        /// </summary>
        /// <param name="KhacHangId"></param>
        /// <returns></returns>
        public DataTable LayBang(decimal KhacHangId)
        {
            return TheDAO.LayBang(KhacHangId);
        }

        /// <summary>
        /// Lấy bảng thẻ chưa thu tiền theo khách hàng
        /// </summary>
        /// <param name="KhacHangId"></param>
        /// <returns></returns>
        public DataTable LayBangTheChuaThu(decimal KhacHangId)
        {
            return TheDAO.LayBangTheChuaThu(KhacHangId);
        }

      /// <summary>
      /// Lấy danh sách thẻ theo khách hàng
      /// </summary>
      /// <param name="KhacHangId"></param>
      /// <returns></returns>
        public List<clsTheDTO> LayDanhSach(decimal KhacHangId)
        {
            return TheDAO.LayDanhSach(KhacHangId);
        }

        /// <summary>
        /// Lấy danh sách thẻ chưa thu tiền theo khách hàng
        /// </summary>
        /// <param name="KhacHangId"></param>
        /// <returns></returns>
        public List<clsTheDTO> LayDanhSachTheChuaThu(decimal KhacHangId)
        {
            return TheDAO.LayDanhSachTheChuaThu(KhacHangId);
        }

        /// <summary>
        /// Lay thong tin mot the
        /// </summary>
        /// <param name="MaThe"></param>
        /// <returns></returns>
        public clsTheDTO LayThongTinThe(string MaThe)
        {
            return TheDAO.LayThongTinThe(MaThe);
        }

        /// <summary>
        /// Kiem tra the ton tai (true: ton tai, fale: khong ton tai)
        /// </summary>
        /// <param name="MaThe"></param>
        /// <returns></returns>
        public bool KiemTraTonTai(string MaThe)
        {
            if (LayThongTinThe(MaThe) != null)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Phát sinh mã thẻ mới
        /// </summary>
        /// <returns></returns>
        public string LayMaTheMoi()
        {
            return TheDAO.LayMaTheMoi();
        }

        /// <summary>
        ///  Thêm thông Thẻ
        /// </summary>
        /// <param name="The"></param>
        /// <returns></returns>
        public bool Them(ref clsTheDTO The)
        {
            The.TheId = TheDAO.Them(The);
            if (The.TheId != -1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Sửa thông tin Thẻ
        /// </summary>
        /// <param name="The"></param>
        /// <returns></returns>
        public bool Sua(clsTheDTO The)
        {
            if (TheDAO.Sua(The) != -1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Xóa thông tin Thẻ
        /// </summary>
        /// <param name="MaThe">Mã thẻ</param>
        public bool XoaTamThoi(decimal TheId)
        {
            if (TheDAO.XoaTamThoi(TheId) != -1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// Xóa thông tin Thẻ
        /// </summary>
        /// <param name="MaThe">Mã thẻ</param>
        public bool Xoa(decimal TheId)
        {
            if (TheDAO.Xoa(TheId) != -1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

    }
}
